<?php

use yii\db\Migration;

class m190128_170332_orders extends Migration
{
    public function up()
    {
        $this->addColumn('{{%orders}}', 'name', $this->string(20)->notNull()->comment('称呼')->after('user_id'));
        $this->addColumn('{{%orders}}', 'phone', $this->string(40)->notNull()->comment('电话')->after('name'));
        $this->addColumn('{{%orders}}', 'area_id', $this->bigInteger()->notNull()->defaultValue(0)->comment('地区')->after('phone'));
        $this->addColumn('{{%orders}}', 'address', $this->string()->notNull()->comment('地址')->after('area_id'));
        $this->addColumn('{{%orders}}', 'memo', $this->string()->notNull()->comment('备注')->after('address'));
    }

    public function down()
    {
        $this->dropColumn('{{%orders}}', 'name');
        $this->dropColumn('{{%orders}}', 'phone');
        $this->dropColumn('{{%orders}}', 'area_id');
        $this->dropColumn('{{%orders}}', 'address');
        $this->dropColumn('{{%orders}}', 'memo');
    }
}
